package com.user.mapper;

import com.bean.WmsTPermission;
import com.bean.WmsTStore;
import com.bean.WmsTTray;
import com.bean.WmsTUser;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface MyMapper {
    @Select("select wms_t_user.*,wms_t_permission.permName from wms_t_user left join\n" +
            "wms_t_u_g on wms_t_u_g.ugUserId = wms_t_user.userID left join\n" +
            "wms_t_group on wms_t_group.groupID = wms_t_u_g.ugID left join\n" +
            "wms_t_perm_group on wms_t_perm_group.groupID = wms_t_group.groupID left join\n" +
            "wms_t_permission on wms_t_permission.permID = wms_t_perm_group.permID\n" +
            "where userAccount = #{userAccount} and userPwd = #{userPwd}\n")
    public WmsTUser load(WmsTUser wmsTUser);

    @Select("select * from wms_t_permission")
    public List<WmsTPermission> selectPer();

    @Select("select * from wms_t_store")
    public List<WmsTStore> selectStore();

    @Select("select * from wms_t_tray where siteID in(\n" +
            "select siteID from wms_t_site where storeID in(\n" +
            "select storeID from wms_t_store\n" +
            "WHERE storeName = #{value}))")
    public List<WmsTTray> seltray(String storeID);
}
